package com.linkit.main.article;

import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.RelativeLayout;

import com.linkit.main.FinishedCallback;
import com.linkit.main.GeneralAnimationUtils;
import com.linkit.main.MainActivity;
import com.linkit.main.R;

public class AdvertiseLayout implements OnClickListener {
	private MainActivity main;
	private RelativeLayout advContentLayout;
	/**Lưu trữ giao diện thông tin quảng cáo*/
	public RelativeLayout advLayout;

	public AdvertiseLayout() {
		main = MainActivity.getInstance();
		advLayout = main.contentManager.advLayout;
	}

	public void showPages(){
		advLayout.setVisibility(View.VISIBLE);
		
		advContentLayout = (RelativeLayout) main.findViewById(R.id.adv_content);
		GeneralAnimationUtils.startBottomToTop(advContentLayout);
		
		ImageView closeBtnView = (ImageView) main
				.findViewById(R.id.adv_close);
		closeBtnView.setOnClickListener(this);
	}
	
	

	@Override
	public void onClick(View v) {
		int id = v.getId();
		switch (id) {
		case R.id.adv_close:
			GeneralAnimationUtils.startTopToBottom(advContentLayout, new FinishedCallback() {
				
				@Override
				public void finish() {
					advLayout.setVisibility(View.GONE);
				}
			});
			break;
		}
	}
}
